package com.wn55.hrms.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wn55.hrms.entity.Attendance;
import com.wn55.hrms.mapper.AttendanceMapper;
import com.wn55.hrms.service.vo.AttendanceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Mr.bai~
 * @version 1.0
 * @date 2022/5/5 15:11
 */
@Service
public class AttendanceService {

    @Autowired
    AttendanceMapper attendanceMapper;


    public PageInfo<AttendanceVo> queryAttendance(Integer now, Integer size, String empName) {
        PageHelper.startPage(now,size);
        List<AttendanceVo> list= attendanceMapper.selectByEmpName(empName);
        return new PageInfo<>(list);

    }

    public void removeBykey(int id) {
        attendanceMapper.deleteByPrimaryKey(id);
    }

    public void add(Attendance attendance) {
        attendanceMapper.insertAttendance(attendance);
    }
}
